package de.sendorian.app.forumArchive.renamer;


import de.sendorian.app.forumArchive.domain.File;
import de.sendorian.app.forumArchive.domain.Post;
import de.sendorian.app.forumArchive.repository.FileRepository;

public class AppendUserShortnameRenamer implements FileRenamer {

	public AppendUserShortnameRenamer() {
	}


	public void rename(File file) {
		Post post = new FileRepository().findPostByFile(file);
		if (post != null) {
			// FIXME as long as files in archives are not renamed this causes duplicates!
			// file.checkAndCorrectAuthorAppendix();
			file.appendUserShortname(post.getAuthor().getShortName());
		}
	}
}
